{extend name="Base" /}
{block name="title"}{$title}{/block}
{block name="container"}
{block name="body"}
<form action="/index/movie" method="post" class="am-container am-g am-form" role="form">
	<div class="am-input-group">
		<input type="text" class="am-form-field" name="name" placeholder="搜你所搜">
		<i class="am-input-group-btn">
			<button class="am-btn am-btn-default search" type="submit"><i class="am-icon-search" title="检索"></i></button>
		</i>
	</div>
</form>
<hr/>
<div class="customcontainer">
	{$page}
	<table class="am-table am-table-bordered am-table-radius am-table-striped am-table-centered am-table-compact am-table-hover">
		<thead>
		<tr>
			<th colspan="2" class="am-show-md-up"><i class="am-icon-slack" title="分类"></i></th>
			<th><i class="am-icon-th-list" title="标题"></i></th>
			<th><i class="am-icon-filter" title="标记"></i></th>
			<th class="am-show-md-up"><i class="am-icon-history" title="发布时间"></i></th>
			<th class="am-show-md-up"><i class="am-icon-file-text" title="文件数量"></i></th>
			<th class="am-show-md-up"><i class="am-icon-th" title="种子大小"></i></th>
			<th class="am-show-md-up"><i class="am-icon-check" title="完成数"></i></th>
			<th><i class="am-icon-arrow-up" title="做种数"></i></th>
			<th class="am-show-md-up"><i class="am-icon-arrow-down" title="下载数"></i></th>
			<th class="am-show-md-up"><i class="am-icon-user" title="发布者"></i></th>
		</tr>
		</thead>
		<tbody>
		{volist name="movie" id="m"}
		<tr id="list_{$m.id}" class="am-text-middle">
			<td class="am-text-middle am-text-nowrap am-show-md-up" colspan="2">{$m.olcate} {$m.slcate}</td>
			<td class="am-text-middle">
				<div class="am-fl am-text-left am-show-lg-only">
					<div><a href="/movie/id/{$m.id}">{$m.maintitle}</a></div>
					<div class="am-link-muted">{$m.subtitle}</div>
				</div>
				<div class="am-fr am-text-right am-show-lg-only">
					{if condition="!empty($m.imdbscore)"}
					<a href="{$m.imdburl}" target="_blank" rel="nofollow">IMDb:{$m.imdbscore}</a>
					{/if}
					<a href="/report/{$m.id}/m" title="反馈种子"><i class="am-icon-exclamation-circle"></i></a>
					<a href="javascript:void(0)" onclick="addCart(this.name, 'm')" title="加入小货车" name="{$m.id}">
						{if condition="$m.rss neq 1"}
						<i class="am-icon-cart-plus cart-{$m.id}"></i>&nbsp;
						{else /}
						<i class="am-icon-cart-plus cart-{$m.id}" style="color: #0e90d2"></i>&nbsp;
						{/if}
					</a>
					<a href="/dl/m/{$m.id}/{$userinfo.uuid}" title="下载种子"><i class="am-icon-arrow-circle-o-down"></i>&nbsp;</a>
				</div>
				<div class="am-fl am-text-left am-hide-lg-only">
					<div class="am-text-truncate" style="width: 200px"><a href="/movie/id/{$m.id}">{$m.maintitle}</a></div>
					<div class="am-link-muted am-text-truncate" style="width: 200px">{$m.subtitle}</div>
				</div>
				<div class="am-fr am-text-right am-hide-lg-only">
					{if condition="!empty($m.imdbscore)"}
					<a href="{$m.imdburl}" target="_blank" rel="nofollow">IMDb:{$m.imdbscore}</a>
					{/if}
					<a href="/report/{$m.id}/m" title="反馈种子"><i class="am-icon-exclamation-circle"></i></a>
					<a href="javascript:void(0)" onclick="addCart(this.name, 'm')" title="加入小货车" name="{$m.id}">
						{if condition="$m.rss neq 1"}
						<i class="am-icon-cart-plus cart-{$m.id}"></i>&nbsp;
						{else /}
						<i class="am-icon-cart-plus cart-{$m.id}" style="color: #0e90d2"></i>&nbsp;
						{/if}
					</a>
					<a href="/dl/m/{$m.id}/{$userinfo.uuid}" title="下载种子"><i class="am-icon-arrow-circle-o-down"></i>&nbsp;</a>
				</div>
			</td>
			<td class="am-text-middle">
				<div>
					{php}$userinfo['movielasttime'] <= $m['addtime'] ? print("<span class='am-badge am-radius new'>新种</span>") : "";{/php}
					{php}$m['official'] == 1 ? print("<a href='?official'><span class='am-badge am-radius official'>官方</span></a>") : "";{/php}
					{php}$m['first'] == 1 ? print("<a href='?first'><span class='am-badge am-radius first'>首发</span></a>") : "";{/php}
					{php}$m['excl'] == 1 ? print("<a href='?excl'><span class='am-badge am-radius excl'>独占</span></a>") : "";{/php}
					{php}$m['bump'] == 1 ? print("<a href='?bump'><span class='am-badge am-radius bumpoff'>救活</span></a>") : "";{/php}
				</div>
				{if condition="($access eq 1) OR ($m.uploader eq $userinfo.uid)"}
				<div>
					<a href='/edit/{$m.id}/m'><span class='am-badge am-radius'>编辑</span></a>
					{if condition="$access eq 1"}
					<a href='/delete/{$m.id}/m'><span class='am-badge am-radius'>删除</span></a>
					{/if}
				</div>
				{/if}
			</td>
			<td class="am-text-middle am-text-nowrap am-show-md-up">
				<div>{$m.ymd}</div>
				<div>{$m.his}</div>
			</td>
			<td class="am-text-middle am-text-nowrap am-show-md-up">{$m.torrentfiles}</td>
			<td class="am-text-middle am-text-nowrap am-show-md-up">{$m.torrentsize|getSize}</td>
			<td class="am-text-middle am-text-nowrap am-show-md-up">{$m.completed}</td>
			<td class="am-text-middle am-text-nowrap">{$m.seeder}</td>
			<td class="am-text-middle am-text-nowrap am-show-md-up">{$m.leecher}</td>
			<td class="am-text-middle am-text-nowrap am-show-md-up">{$m.uploadername}</td>
		</tr>
		{/volist}
		</tbody>
	</table>
	{$page}
</div>
<div class="am-modal am-modal-alert" tabindex="-1" id="my-alert">
	<div class="am-modal-dialog">
		<div class="am-modal-hd">错误</div>
		<div class="am-modal-bd">失败</div>
		<div class="am-modal-footer">
			<span class="am-modal-btn" data-am-modal-confirm>知道了</span>
		</div>
	</div>
</div>
<br/>
<script>
	function addCart(id, type) {
		var data = {
			id: id,
			type: type
		};
		var $bd = $(".am-modal-bd");
		var $cartid = $(".cart-" + id);
		$.ajax({
			type: "POST",
			url: "/index/truck/index",
			cache: false,
			data: data,
			dataType: "json",
			success: function (data) {
				if (data.status === 0) {
					if (data.message) {
						$bd.html(data.message);
					}
					$("#my-alert").modal();
				} else if (data.status === 1) {
					$(".am-modal-hd").html("成功");
					$bd.html(data.message);
					$cartid.css("color", "#0e90d2");
					$("#my-alert").modal();
				} else if (data.status === 2) {
					$(".am-modal-hd").html("成功");
					$bd.html(data.message);
					$cartid.css("color", "");
					$("#my-alert").modal();
				} else {
					$bd.html("系统故障，请稍候再试");
					$("#my-alert").modal();
				}
			}
		});
	}
</script>
{/block}
{/block}